function bindData(rowData){
	var unemployedinfoId = rowData.unemployedinfoId;
	$("#addEmployedAidForm").form('load',rowData);
	$("#addDifficultTrackForm").form('load',rowData);
	$("#addAidEffectForm").form('load',rowData);
	
	$("#employedAidGrid").datagrid({
		singleSelect:true,
	    pagination:true,
	    rownumbers:true,
	    url:'jobless/jobAdvice/getAdviceInfoList',  
	    queryParams:{
	    	unemployedinfoId:unemployedinfoId
	    },
	    columns:[[ 
	            {field:'unemployedinfoId',hidden:true}, 
	            {field:'date',title:'时间',width:100,rowspan:2,formatter:formatterDate,align:'center'},
		        {field:'name',title:'就业协理员',width:100,rowspan:2,align:'center'},  
		        {title:'提供就业服务情况',colspan:4,align:'center'},    
		        {title:'援助结果',colspan:3,align:'center'},
		        {field:'remark',title:'备注',width:100,rowspan:2,align:'center'}],  
		        [
		        {field:'guide',title:'职业指导',width:100,align:'center'},    
		        {field:'intruduce',title:'职业介绍',width:100,align:'center'},    
		        {field:'training',title:'技能培训',width:100,align:'center'},   
		        {field:'jobfair',title:'参加招聘会',width:100,align:'center'},    
		        {field:'employdate',title:'就业时间',width:100,formatter:formatterDate,align:'center'},    
		        {field:'headto',title:'就业去向',width:100,align:'center'},
		        {field:'other',title:'其他',width:100,align:'center'}
	    ]]
	});
	
	$("#employedDifficultTrackGrid").datagrid({
		singleSelect:true,
	    pagination:true,
	    url:'jobless/jobAdvice/TrackingRecord',  
	    rownumbers:true,
	    columnfit:true,
	    queryParams:{
	    	unemployedinfoId:unemployedinfoId
	    },
	    columns:[[ 
	            {field:'unemployedinfoId',title:'编号',width:100}, 
		        {field:'name',title:'跟踪对象',width:100},  
		        {field:'topic',title:'走访主题',width:100},
		        {field:'location',title:'走访地点',width:100},    
		        {field:'interviewdate',title:'走访时间',width:100,formatter:formatterDate},
		        {field:'content',title:'走访跟踪主要内容',width:100},
		        {field:'num',title:'人数',width:100}, 
		        {field:'pic',title:'走访记录',width:100}  
	    ]]

	});
	
	$("#employedAidEffectGrid").datagrid({
		singleSelect:true,
	    url:'jobless/jobAdvice/getKnryEffectData',  
	    rownumbers:true,
	    queryParams:{
	    	unemployedinfoId:unemployedinfoId
	    },
	    columns:[[ 
              	{field:'unemployedinfoId',title:'编号',width:100}, 
		        {field:'name',title:'帮扶对象',width:100},    
		        {field:'employdate',title:'就业时间',width:100,formatter:formatterDate},
		        {field:'company',title:'工作单位',width:100},
		        {field:'companytype',title:'单位性质',width:100},    
		        {field:'position',title:'岗位',width:100},
		        {field:'salary',title:'月薪待遇',width:100},
		        {field:'satisfaction',title:'工作满意度',width:100},
		        {field:'competence',title:'工作胜任程度',width:100},
		        {field:'suggestion',title:'意见',width:100},
		        {field:'name',title:'援助对象签字',width:100},
		        {field:'staff',title:'工作人员签字',width:100}
	        ]],
	    pagination:true
	});
}

/**
 * 添加就业援助记录
 */
function saveEmployedAid(){
	$('#addEmployedAidForm').form('submit',{
		url:'jobless/jobAdvice/updateJoblessInfoServer',
		success: function(data){
			data =  $.parseJSON(data);
			if(data.success == 'true'){
				$.messager.alert('提示','保存成功','info');
				$('#addEmployedAid').window('close');
				$('#addEmployedAidForm').form('clear');
				$('#employedAidGrid').datagrid('load');
			}else{
				$.messager.alert('提示',data.message,'info');
				$('#addEmployedAid').window('close');
			}
		}
	});
}
/**
 * 删除就业援助
 */
function deleteJobAdvice(){
	var rowData = $('#employedAidGrid').datagrid('getSelected');
	if(rowData == undefined){
		$.messager.alert('消息','请选择一条数据');
	}else{
		$.messager.confirm('提示','确定要删除吗？',function(r){
			if(r){
				$.ajax({
					url:'jobless/jobAdvice/deleteJobAdvice',
					type:'post',
					data:{
						Id:rowData.Id
					},
					success:function(data){
						data =  $.parseJSON(data);
						if(data.success == 'true'){
							$('#employedAidGrid').datagrid('load');
							$('#employedAidGrid').datagrid('unselectAll');
						}else{
							$.messager.alert('提示',data.message,'info');
						}
					}
				});
			}
		});
	}
}
/**
 * 添加城乡就业困难人员跟踪服务记录
 */
function saveDifficultTrack(){
	$('#addDifficultTrackForm').form('submit',{
		url:'jobless/jobAdvice/updateTrackingRecord',
		success: function(data){
			debugger;
			data =  $.parseJSON(data);
			if(data.success == 'true'){
				$.messager.alert('提示','保存成功','info');
				$('#addDifficultTrack').window('close');
				$('#addDifficultTrackForm').form('clear');
				$('#employedDifficultTrackGrid').datagrid('load');
			}else{
				$.messager.alert('提示',data.message,'info');
				$('#addDifficultTrack').window('close');
			}
		}
	});
}

/**
 * 删除城乡就业困难人员跟踪服务记录
 */
function deleteDifficultTrack(){
	var rowData = $('#employedDifficultTrackGrid').datagrid('getSelected');
	if(rowData == undefined){
		$.messager.alert('消息','请选择一条数据');
	}else{
		$.messager.confirm('提示','确定要删除吗？',function(r){
			if(r){
				$.ajax({
					url:'jobless/jobAdvice/deleteTRackingRecord',
					type:'post',
					data:{
						unemployedinfoId:rowData.unemployedinfoId
					},
					success:function(data){
						data =  $.parseJSON(data);
						if(data.success == 'true'){
							$('#employedDifficultTrackGrid').datagrid('load');
						}else{
							$.messager.alert('提示',data.message,'info');
						}
					}
				});
			}
		});
	}
}
/**
 * 添加城乡就业困难人员就业援助效果
 */
function saveAidEffect(){
	$('#addAidEffectForm').form('submit',{
		url:'jobless/jobAdvice/updateKnryEffect',
		success: function(data){
			debugger;
			data =  $.parseJSON(data);
			if(data.success == 'true'){
				$.messager.alert('提示','保存成功','info');
				$('#addAidEffect').window('close');
				$('#addAidEffectForm').form('clear');
				$('#employedAidEffectGrid').datagrid('load');
			}else{
				$.messager.alert('提示',data.message,'info');
				$('#addAidEffect').window('close');
			}
		}
	});
}

/**
 * 删除城乡就业困难人员就业援助效果
 */
function deleteAidEffect(){
	var rowData = $('#employedAidEffectGrid').datagrid('getSelected');
	if(rowData == undefined){
		$.messager.alert('消息','请选择一条数据');
	}else{
		$.messager.confirm('提示','确定要删除吗？',function(r){
			if(r){
				$.ajax({
					url:'jobless/jobAdvice/deleteTRackingRecord',
					type:'post',
					data:{
						unemployedinfoId:rowData.unemployedinfoId
					},
					success:function(data){
						data =  $.parseJSON(data);
						if(data.success == 'true'){
							$('#employedAidEffectGrid').datagrid('load');
						}else{
							$.messager.alert('提示',data.message,'info');
						}
					}
				});
			}
		});
	}
}


/**
 * 日期格式化
 * @param value
 * @param row
 * @returns {String}
 */
function formatterDate(value, row) {
    var date = new Date(value);
    return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
}

